#ifndef __OLED_H
#define __OLED_H			  	 

#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#include <drivers/i2c.h>

typedef uint8_t   	u8;
typedef char    	s8;
typedef uint16_t  	u16;
typedef int16_t   	s16;
typedef uint32_t  	u32;
typedef int32_t   	s32;

#define RST_PIN 	GET_PIN(H, 2)
#define DC_PIN 		GET_PIN(H, 3)
#define SCL_PIN 	GET_PIN(H, 4)
#define SDA_PIN 	GET_PIN(H, 5)

//-----------------OLED端口定义----------------
#define OLED_RST_Clr() rt_pin_write(RST_PIN, 0)   	//RST
#define OLED_RST_Set() rt_pin_write(RST_PIN, 1)   	//RST

#define OLED_DC_Clr() rt_pin_write(DC_PIN, 0)		//DC
#define OLED_DC_Set() rt_pin_write(DC_PIN, 1) 	 	//DC

#define OLED_SCLK_Clr()  rt_pin_write(SCL_PIN, 0)  	//SCL
#define OLED_SCLK_Set()  rt_pin_write(SCL_PIN, 1)   //SCL

#define OLED_SDIN_Clr()  rt_pin_write(SDA_PIN, 0)   //SDA
#define OLED_SDIN_Set()  rt_pin_write(SDA_PIN, 1)	//SDA

#define OLED_CMD  0	//写命令
#define OLED_DATA 1	//写数据

//OLED控制用函数
void OLED_WR_Byte(u8 dat, u8 cmd);
void OLED_Display_On(void);
void OLED_Display_Off(void);
void OLED_Refresh_Gram(void);
void OLED_Init(void);
void OLED_Clear(void);
void OLED_DrawPoint(u8 x, u8 y, u8 t);
void OLED_ShowChar(u8 x, u8 y, u8 chr, u8 size, u8 mode);
void OLED_ShowNumber(u8 x, u8 y, u32 num, u8 len, u8 size);
void OLED_ShowString(u8 x, u8 y, const s8 *p);
#endif  

